﻿using System.WindowsCe.Mvp.Views;

namespace System.WindowsCe.Mvp.Presenters
{
	public abstract class PresenterBase<TView, TContextModel> : IPresenter<TView, TContextModel>
		where TView : IView
		where TContextModel : class
	{
		public virtual string Name
		{
			get { return GetType().Name.Substring(0, GetType().Name.LastIndexOf("Presenter")); }
		}

		public TView View { get; protected set; }

		IView IPresenter.View
		{
			get { return View; }
		}

		protected PresenterBase(TView view)
		{
			View = view;
			//ContextModel = ApplicationController.Argument as TContextModel;
		}

		public TContextModel ContextModel { get; protected set; }

		//public void SetView(TView view)
		//{
		//    View = view;
		//}

		public void SetContextModel(TContextModel contextModel)
		{
			ContextModel = contextModel;
		}
	}
}